package com.fu.response;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;

/**
 * @Class : RestResult
* @Description : RESTful应用统一的返回结果类
* @author : Little Ant
* @Creation Date : 2017/11/1
* @ModificationHistory   who      when        what
* -------  -----------  ------------------------------
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RestResult<T> implements Serializable{
    private String status;

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    private String code;
    private String message;
    private Object data;

    public String getMessage() {
        return message;
    }

    public Object getData() {
        return data;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void setData(Object data) {
        this.data = data;
    }

    private RestResult(){}

    public static<T> RestResult<T> newInstance(){
        return new RestResult<>();
    }

    @Override
    public String toString() {
        return "RestResult{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
